package com.zjj.spring.read.xml.factorybean;

/**
 * 这是一个工厂类，通过工厂方法产生对应bean
 * 注意 factory-bean 和 FactoryBean 的区别
 * 前者是静态工厂或实例工厂，而后者是 Spring 中的特殊接口
 * @author zhuangjiajie778
 */
public class MyFactoryBeanMethod {

	private String name = "AAA";
	/**产生本类自身对象*/
	public MyFactoryBeanMethod newInstanceBeanMethod () {
		MyFactoryBeanMethod myFactoryBeanMethod = new MyFactoryBeanMethod();
		myFactoryBeanMethod.setName("BBB");
		return myFactoryBeanMethod;
	}
	/**也可产生其他类型对象，并不一定要和工厂类的类型一致*/
	public String newStringBeanMethod () {
		return "newStringBeanMethod is here";
	}
	/**静态工厂类可直接生成对象，无需指定工厂bean*/
	public static String newStatciStringBeanMethod () {
		return "this is a static factory Method bean";
	}
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

}
